package com.xwqiang.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.xwqiang.model.vo.AdminVo;
import com.xwqiang.utils.Resp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/goods")
public class GoodsController {

    @Autowired
    private RestTemplate restTemplate;


    @GetMapping("/list")
    public Resp list(){
        String url = "http://localhost:8100/admins/string";
        String aaa = restTemplate.getForObject(url, String.class);

        return Resp.success(aaa);
    }

    @GetMapping("/get")
    public Resp admin(){
        String url = "http://localhost:8100/admins/1";
        String jsonStr = restTemplate.getForObject(url, String.class);
        return Resp.success(jsonStr);
    }
}
